package com.ruoyi.api.controller;

import com.ruoyi.api.domain.UserAddress;
import com.ruoyi.api.service.IUserAddressService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 用户地址表
 *
 * @author 寻觅
 * @since 2025-05-28
 */
@RestController
@RequestMapping("/user/address")
public class UserAddressController {
    @Autowired
    IUserAddressService userAddressService;

    @GetMapping("/info")
    public AjaxResult info(@RequestParam Long userId) {
        return AjaxResult.success(userAddressService.info(userId));
    }

    /**
    ***添加
    **/
    @PostMapping("/add")
    public AjaxResult add(@RequestBody UserAddress userAddress) {
        return AjaxResult.success(userAddressService.save(userAddress));
    }

    /**
     * 修改
     */
    @PostMapping("edit")
    public AjaxResult edit(@RequestBody UserAddress userAddress){
        return AjaxResult.success(userAddressService.
                edit(userAddress));
    }

}
